clear all 

*** Your path here
cd ... 
 


*** CLASS
clear all 
 

use "potentials.dta", clear


gen idnew=ccode*10000+respondentid

gen att5_headscarf_rev=-att5_headscarf+3

gen cultpos=((att4_immig-1)/2+(att5_headscarf_rev-1)+(att6_gender-1)/2+(att7_ecology-1)/2)/4
gen econpos=((att1_earlyret-1)/2+(att2_childcare-1)+(att3_inheritax-1)/2+(att8_jobprotection-1)+(att9_housing-1)/2)/5

*** scp

reg choice c.cultpos##c.econpos if oesch_3==1, cl(~idnew)


** FOUR SCENARIOS


margins, at(cultpos=0 econpos=0) ///
at(cultpos=1 econpos=0) ///
at(cultpos=0 econpos=1) ///
at(cultpos=1 econpos=1) 

matrix marg=r(table)[1..4,1..4]

*****
* Prod workers
****

reg choice c.cultpos##c.econpos if oesch_3==2, cl(~idnew)



** FOUR SCENARIOS
margins, at(cultpos=0 econpos=0) ///
at(cultpos=1 econpos=0) ///
at(cultpos=0 econpos=1) ///
at(cultpos=1 econpos=1) 
matrix marg2=r(table)[1..4,1..4]


matrix marg3=marg,marg2
matrix marg3=marg3'

svmat marg3
rename marg31 b
rename marg32 se
gen cilow=b-1.96*se
gen cihigh=b+1.96*se
gen index=_n if _n<9

graph twoway (bar b index, barwidth(.5)) (rcap cihigh cilow index), ///
xlabel(1 "CULT LEFT" 2 "CULT MOD" 3 "CULT LEFT" 4 "CULT MOD" 5 "CULT LEFT" 6 "CULT MOD" 7 "CULT LEFT" 8 "CULT MOD") scheme(plottig) legend(off)  title("Socio-cultural professionals                                           Production workers    ") xtitle("ECON LEFT                            ECON MOD                               ECON LEFT                               ECON MOD") xline(4.5)  yscale(range(-.1 0.8)) ylabel(0(.2).8)



graph export "Figure10.png", as(png) replace
graph export "Figure10.tif", as(tif) width(2000) replace

* sig tests

reg choice c.cultpos##c.econpos if oesch_3==2, cl(~idnew)
margins, dydx(cultpos) at(econpos=1) 
margins, dydx(cultpos) at(econpos=0) 
margins,  dydx(cultpos) at(econpos=(0 1))  pwcompare 
margins, dydx(econpos) at(cultpos=1) 
margins,  dydx(econpos) at(cultpos=0)
margins,  dydx(econpos) at(cultpos=(0 1))  pwcompare  

reg choice c.cultpos##c.econpos if oesch_3==1, cl(~idnew)
margins, dydx(cultpos) at(econpos=1) 
margins, dydx(cultpos) at(econpos=0) 
margins,  dydx(cultpos) at(econpos=(0 1))  pwcompare 
margins, dydx(econpos) at(cultpos=1) 
margins,  dydx(econpos) at(cultpos=0)
margins,  dydx(econpos) at(cultpos=(0 1))  pwcompare

*****
*** YOUNG
*****

use "potentials.dta", clear


gen idnew=ccode*10000+respondentid

gen att5_headscarf_rev=-att5_headscarf+3

gen cultpos=((att4_immig-1)/2+(att5_headscarf_rev-1)+(att6_gender-1)/2+(att7_ecology-1)/2)/4
gen econpos=((att1_earlyret-1)/2+(att2_childcare-1)+(att3_inheritax-1)/2+(att8_jobprotection-1)+(att9_housing-1)/2)/5

reg choice c.cultpos##c.econpos if age_groups==1, cl(~idnew)


** FOUR SCENARIOUS

margins, at(cultpos=0 econpos=0) ///
at(cultpos=1 econpos=0) ///
at(cultpos=0 econpos=1) ///
at(cultpos=1 econpos=1) 

matrix marg=r(table)[1..4,1..4]

*****
* OLD
****

reg choice c.cultpos##c.econpos if age_groups==4, cl(~idnew)



** FOUR SCENARIOUS


margins, at(cultpos=0 econpos=0) ///
at(cultpos=1 econpos=0) ///
at(cultpos=0 econpos=1) ///
at(cultpos=1 econpos=1) 

matrix marg2=r(table)[1..4,1..4]

matrix marg3=marg,marg2
matrix marg3=marg3'

svmat marg3
rename marg31 b
rename marg32 se
gen cilow=b-1.96*se
gen cihigh=b+1.96*se
gen index=_n if _n<9

graph twoway (bar b index, barwidth(.5)) (rcap cihigh cilow index), ///
xlabel(1 "CULT LEFT" 2 "CULT MOD" 3 "CULT LEFT" 4 "CULT MOD" 5 "CULT LEFT" 6 "CULT MOD" 7 "CULT LEFT" 8 "CULT MOD") scheme(plottig) legend(off)  title("Voters under 35                                                       Voters over 65") xtitle("ECON LEFT                            ECON MOD                               ECON LEFT                               ECON MOD") xline(4.5) yscale(range(-.1 0.8)) ylabel(0(.2).8) 


graph export "Figure11.png", as(png) replace
graph export "Figure11.tif", as(tif) width(2000) replace

reg choice c.cultpos##c.econpos if age_groups==4, cl(~idnew)
margins, dydx(cultpos) at(econpos=1) 
margins,  dydx(cultpos) at(econpos=0)  
margins,  dydx(cultpos) at(econpos=(0 1))  pwcompare

margins, dydx(econpos) at(cultpos=1) 
margins,  dydx(econpos) at(cultpos=0)  
margins,  dydx(econpos) at(cultpos=(0 1))  pwcompare

reg choice c.cultpos##c.econpos if age_groups==1, cl(~idnew)
margins, dydx(cultpos) at(econpos=1) 
margins, dydx(cultpos) at(econpos=0) 
margins,  dydx(cultpos) at(econpos=(0 1))  pwcompare 
margins, dydx(econpos) at(cultpos=1) 
margins,  dydx(econpos) at(cultpos=0)
margins,  dydx(econpos) at(cultpos=(0 1))  pwcompare



*************************************
************* EDUCATION

clear all 
 

use "potentials.dta", clear

gen idnew=ccode*10000+respondentid

gen att5_headscarf_rev=-att5_headscarf+3

gen cultpos=((att4_immig-1)/2+(att5_headscarf_rev-1)+(att6_gender-1)/2+(att7_ecology-1)/2)/4
gen econpos=((att1_earlyret-1)/2+(att2_childcare-1)+(att3_inheritax-1)/2+(att8_jobprotection-1)+(att9_housing-1)/2)/5


*** High educ

reg choice c.cultpos##c.econpos if educ_2==3, cl(~idnew)


** FOUR SCENARIOS


margins, at(cultpos=0 econpos=0) ///
at(cultpos=1 econpos=0) ///
at(cultpos=0 econpos=1) ///
at(cultpos=1 econpos=1) 

matrix marg=r(table)[1..4,1..4]

*****
* Low educ
****

reg choice c.cultpos##c.econpos if educ_2==1, cl(~idnew)

** FOUR SCENARIOS

margins, at(cultpos=0 econpos=0) ///
at(cultpos=1 econpos=0) ///
at(cultpos=0 econpos=1) ///
at(cultpos=1 econpos=1)  

matrix marg2=r(table)[1..4,1..4]


matrix marg3=marg,marg2
matrix marg3=marg3'

svmat marg3
rename marg31 b
rename marg32 se
gen cilow=b-1.96*se
gen cihigh=b+1.96*se
gen index=_n if _n<9

graph twoway (bar b index, barwidth(.5)) (rcap cihigh cilow index), ///
xlabel(1 "CULT LEFT" 2 "CULT MOD" 3 "CULT LEFT" 4 "CULT MOD" 5 "CULT LEFT" 6 "CULT MOD" 7 "CULT LEFT" 8 "CULT MOD") scheme(plottig) legend(off)  title( "High education                                                        Low education") xtitle("ECON LEFT                            ECON MOD                               ECON LEFT                               ECON MOD") xline(4.5)  yscale(range(-.1 0.8)) ylabel(0(.2).8)


graph export "FigureE3.png", as(png) replace
graph export "FigureE3.tif", as(tif)  width(2000) replace


